package com.example.demo.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;


import com.example.demo.generator.domain.User;
import com.example.demo.generator.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/api")
public class Index {


    @Autowired
    private UserService userService;



    @Transactional
    @GetMapping("/hello")
    public List<User> index1(){

        int i = 9;

        LambdaQueryWrapper<User>userLambdaQueryWrapper=new LambdaQueryWrapper<>();
        userLambdaQueryWrapper.select(User::getId);
        List<User> list = userService.list(userLambdaQueryWrapper);

//userService.performTransaction();

        return list;

    }


}

